package ooap;

/**
 * @author yuisama
 * @date 2022/09/05 21:16
 **/
public class Japanese {
    public String name;
    public int age;
    // 使用static修饰的属性称之为类属性，和具体的对象无关
    public static String country = "日本";
    public Japanese(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public void show() {

        System.out.println("姓名为:" + name + ",年龄为:" + age + "，国籍为:" + country);
    }
    public static void main(String[] args) {
        Japanese j1 = new Japanese("小泉纯一郎",60);
        Japanese j2 = new Japanese("安倍晋三",65);
        Japanese j3 = new Japanese("稻盛和夫",90);
        // 直接通过类名称访问静态变量
        Japanese.country = "中国";
        j1.show();
        j2.show();
        j3.show();
    }
}